package com.amigo.online.provider.manager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.amigo.online.common.base.service.BaseService;
import com.amigo.online.provider.manager.mapper.HobbyTblMapper;
import com.amigo.online.provider.manager.model.entity.HobbyTbl;
import com.amigo.online.provider.manager.service.HobbyTblService;

@Service
public class HobbyTblServiceImpl extends BaseService<HobbyTbl> implements HobbyTblService {
    @Resource
    HobbyTblMapper hobbyTblMapper;

    @Override
    public List<HobbyTbl> findHobbyTblList(HobbyTbl hobbyTbl) {

        return hobbyTblMapper.findHobbyTblList(hobbyTbl);

    }

    @Override
    public boolean saveHobbyTbl(HobbyTbl hobbyTbl) {

        hobbyTbl.setCreatedTime(System.currentTimeMillis() / 1000);
        hobbyTbl.setUpdateTime(System.currentTimeMillis() / 1000);
        if (hobbyTblMapper.saveHobbyTbl(hobbyTbl) <= 0) {
            return false;
        } else {
            return true;
        }

    }

    @Override
    public boolean updateHobbyTbl(HobbyTbl hobbyTbl) {
        hobbyTbl.setUpdateTime(System.currentTimeMillis() / 1000);
        if (hobbyTblMapper.updateHobbyTbl(hobbyTbl) <= 0) {
            return false;
        } else {
            return true;
        }

    }

    @Override
    public boolean deleteHobbyTbl(HobbyTbl hobbyTbl) {
        hobbyTbl.setDeleted(1);
        hobbyTbl.setDeleteTime(System.currentTimeMillis() / 1000);
        if (hobbyTblMapper.deleteHobbyTbl(hobbyTbl) <= 0) {
            return false;
        } else {
            return true;
        }
    }

}
